home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
FROMUTS
/
UNIXLIB37B
/
test
/
c
/
sctest
< prev
next >
Wrap
Text File
|
1992-08-29
|
762b
|
35 lines
#include <stdio.h>
int main()
{
int i,n;
float f;
int n1,n2; char l1[3],l2[3];
char b[256];
for (;;)
{
fputs("test 1: ",stdout);
n = scanf("%4d%s\n",&i,b);
printf("ret: %d\n",n);
if (n < 0) break;
if (n >= 1) printf("i: %d\n",i);
if (n >= 2) printf("b: %s\n",b);
fgets(b,256,stdin);
printf("rest of line: \"%s\"\n",b);
fputs("test 2: ",stdout);
n = scanf("alive = %f",&f);
printf("ret: %d\n",n);
if (n < 0) break;
if (n >= 1) printf("f: %f\n",(double)f);
fputs("test 3: ",stdout);
n = scanf("%*s%ld%s%*s%*s%ld%s",&n1,l1,&n2,l2);
printf("ret: %d\n",n);
if (n < 0) break;
if (n >= 1) printf("n1: %d\n",n1);
if (n >= 2) printf("l1: %s\n",l1);
if (n >= 3) printf("n2: %d\n",n2);
if (n >= 4) printf("l2: %s\n",l2);
}
}